package com.tz.colawallet.service;


import com.tz.colawallet.basecode.base.BaseResp;
import com.tz.colawallet.basecode.base.BaseRespNew;
import com.tz.colawallet.basecode.basebean.SelectVoiceInfo;
import com.tz.colawallet.bean.BannerBean;
import com.tz.colawallet.bean.CheckLogin;
import com.tz.colawallet.bean.GetTags;
import com.tz.colawallet.bean.Recommand;
import com.tz.colawallet.bean.UserInfo;
import com.tz.colawallet.bean.UserMessage;

import java.util.List;

import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import rx.Observable;

/**
 * Created by chenjian on 16/6/12.
 */
public interface ApiService {
    //    /**
//     * test
//     */
//    @POST
//    @FormUrlEncoded
//    Observable<BaseResp<Object>> test(@Url String url);
//
//
//    // *************************************************************************
//    // TODO  控制器 user 用户信息
//
//
//    /**
//     * 检测更新(ok)
//     *
//     * @return
//     */
//    @POST("Common/ShopAppVersion")
//    @FormUrlEncoded
//    Observable<BaseResp<AppVersion>> getAppVersion();
//
//
//
//    /**
//     * 登录
//     *
//     * @return
//     */
    @POST("api.php?c=Baijia&a=sign")
    @FormUrlEncoded
    Observable<BaseResp<UserInfo>> loginCheck(@Field("token") String token,
                                              @Field("room_id") String room_id,
                                              @Field("app") String app,
                                              @Field("major_type") String major_type //android or  Ios
    );


    /**
     * 获取录音
     *
     * @return
     */
    @POST("api/voice/selectVoice")
    Observable<BaseRespNew<SelectVoiceInfo>> selectVoice(@Body RequestBody jsonStr);

    @FormUrlEncoded
    @POST("app/sendSms")
    Observable<BaseRespNew> sendSms(@Field("tel") String phone);

    @FormUrlEncoded
    @POST("app/register")
    Observable<BaseRespNew> register(
            @Field("tel") String tel,
            @Field("password") String password,
            @Field("code") String code
    );

    @FormUrlEncoded
    @POST("app/reset")
    Observable<BaseRespNew> reset(
            @Field("oldpwd") String oldpwd,
            @Field("newpwd") String newpwd
    );

    @FormUrlEncoded
    @POST("app/suggest")
    Observable<BaseRespNew> suggest(
            @Field("content") String content
    );

    @FormUrlEncoded
    @POST("app/forget")
    Observable<BaseRespNew> forget(
            @Field("tel") String tel,
            @Field("password") String password,
            @Field("code") String code
    );

    @FormUrlEncoded
    @POST("app/login")
    Observable<BaseRespNew> login(
            @Field("tel") String tel,
            @Field("password") String password
    );

    @FormUrlEncoded
    @POST("app/getTags")
    Observable<BaseRespNew<List<GetTags>>> getTags(@Field("tel") String tel);

    @FormUrlEncoded
    @POST("app/product/recommand")
    Observable<BaseRespNew<List<Recommand>>> recommand(@Field("tel") String tel);

    @FormUrlEncoded
    @POST("app/getBanner")
    Observable<BaseRespNew<List<BannerBean>>> getBanner(@Field("tel") String tel);

    /**
     * loanMoneyId:int,可选
     * loanTypeId:int,可选
     * page:int，必填
     * size:int，必须填
     *
     * @return
     */
    @FormUrlEncoded
    @POST("app/product/list")
    Observable<BaseRespNew<List<Recommand>>> list(
            @Field("loanMoneyId") Integer loanMoneyId,
            @Field("loanTypeId") Integer loanTypeId,
            @Field("page") Integer page,
            @Field("size") Integer size
    );

    @FormUrlEncoded
    @POST("app/checkDetail")
    Observable<BaseRespNew> checkDetail(@Field("tel") String tel);

    @FormUrlEncoded
    @POST("app/product/addApplyNum")
    Observable<BaseRespNew> addApplyNum(@Field("productId") Integer id);

    @FormUrlEncoded
    @POST("app/getUserDetail")
    Observable<BaseRespNew<UserMessage>> getUserDetail(@Field("tel") String tel);

    @FormUrlEncoded
    @POST("app/getLoanMoney")
    Observable<BaseRespNew<List<GetTags>>> getLoanMoney(@Field("tel") String tel);


    @FormUrlEncoded
    @POST("app/getLoanType")
    Observable<BaseRespNew<List<GetTags>>> getLoanType(@Field("tel") String tel);
    @FormUrlEncoded
    @POST("app/checkLogin")
    Observable<BaseRespNew<CheckLogin>> checkLogin(@Field("tel") String tel);


    @FormUrlEncoded
    @POST("app/user/detail")
    Observable<BaseRespNew> detail(
            @Field("username") String username,
            @Field("sex") int sex,
            @Field("birth") String birth,
            @Field("loanMoney") String loanMoney,
            @Field("tagids") String tagids,
            @Field("city") String city
    );


}
